<template>
	<view class="bg-white" style="height: 100vh;">
		<cu-custom :bgColor="NavBarColor" :isBack="true" backFlag="navigate">
			<block slot="backText">返回</block>
			<block slot="content">图片展示</block>
		</cu-custom>
		<view class="cu-list menu margin-top">
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="photosView">
					<block v-for="(item, index) in photos" :key="index">
						<view class="box">
							<image :src="item.src" mode="widthFix" @click="previewImage(index)"></image>
						</view>
					</block>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				NavBarColor: this.NavBarColor,
				annotation: {
					id: "",
					titile: "",
					startTime: "",
					sender: "",
					msgContent: "",
					recordVideo: "",

				},
				goodNumber: null,
				flg: true,
				src: "",
				photos: []
			}
		},
		onLoad: function(option) {
			console.log('####', option.item);

			if (option.item.includes("http")) {

				let arr = option.item.split(',');
				for (let i = 0; i < arr.length-1; i++) {

					let myObject = {
						id: i,
						src: arr[i]
					};
					this.photos.push(myObject)
				}


			} else {
				this.$http.get("/three/getPic", {
					params: {
						pic: option.item
					}
				}).then(res => {
					console.log('%%%%', res.data)

					this.photos = res.data

				})
			}

			console.log('11111111111',this.photos)


		},
		created() {
			console.log("created")
		},
		methods: {
			previewImage(index) {
				let photoList = this.photos.map(item => {
					return item.src;
				});
				uni.previewImage({
					current: index,
					urls: photoList
				});
			}
		}
	}
</script>

<style>
	.photosView {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;

	}

	.box {
		width: 100%;
	}

	.page video {
		width: 750rpx;
	}

	.swiper-image {
		width: 100%;
		height: 100%;
	}
</style>